unit uSelSerial;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type TSelSerial = class(TForm)
 Label1: TLabel;
 ComboBoxDeviceName: TComboBox;
 Label2: TLabel;
 btnOK: TButton;
 procedure btnOKClick(Sender: TObject);
 procedure FormCreate(Sender: TObject);
 private
  { Private declarations }
 public
  { Public declarations }
 end;

var
  SelSerial: TSelSerial;

implementation

uses SDIMAIN;
{$R *.dfm}

procedure TSelSerial.btnOKClick(Sender: TObject);
begin
 if(ComboBoxDeviceName.Items.Count>0)then begin
  SDIAppForm.serial.DeviceName:=ComboBoxDeviceName.Text;
 end;
 close;
end;

procedure TSelSerial.FormCreate(Sender: TObject);
begin
 with ComboBoxDeviceName do begin
  SDIAppForm.serialPort.EnumComDevicesFromRegistry(Items);
  Text:=SDIAppForm.serialPort.DeviceName;
  Label2.Caption:='Total de Portas: '+inttostr(Items.Count);
 end;
end;

end.
